<!DOCTYPE html>
<html>
  <head>
    <title><%- title %></title>
    <link rel='stylesheet' href='/stylesheets/style.css' />
    <%- include common %>
  </head>
  <body>
    <%- include('head', {title: 'index'}) %>

    <div class="container-fluid">
      <div class="container">
        <h3 class="text-primary"><%- title %></h4>

        <% if (username) { %>
          <div>
            <p>欢迎您：<b><%- username %>  /  <%- phone %></b></p>
            <p>登陆时间：<span class="text-danger"><%- loginTime %></span></p>
            <p>当前时间：<span class="text-warning" id="now-time"></span></p>
            <button type="button" class="btn btn-primary" onclick="location.href='/movies'">查看电影</button>
            <button type="button" class="btn btn-danger" onclick="location.href='/logout'">注销</button>
          </div>
        <% } else { %>
          <button type="button" class="btn btn-success" onclick="location.href='/login'">登陆</button>
          <button type="button" class="btn btn-info" onclick="location.href='/register'">注册</button>
        <% } %>
      </div>
  </div>

    <%- include foot %>


    <script>
      window.onload = function() {
        $("#now-time").html(moment().format('YYYY-MM-DD HH:mm:ss'))
        var timer = setInterval(() => {
          $("#now-time").html(moment().format('YYYY-MM-DD HH:mm:ss'))
        }, 1000)
      }
    </script>

  </body>
</html>
